Repository navigation
Conversation
Add a second form of file_sizes: buckets of sizes with the cumulative count of objects at or below each size. A size is drawn by picking a bucket in proportion to the objects it adds, then log-uniformly within the bucket. The lognormal form with p50 and p99 keeps working unchanged. The lognormal fit guesses everything above p99, which put the average object size at 0.64x to 3.3x of production depending on the usecase. Buckets at every power of two, taken from the objectstore.put.size metric, bring the average within about 10% for all production usecases. Add production.example.yaml with one workload per production usecase, with rounded counts that are close to production, and document in the README how to pull the buckets from Datadog.
Semver Impact of This PR⚪ None (no workspace changed) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR does not change any workspace, so it will not appear in any changelog. 🤖 This preview updates automatically when you update the PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #823 +/- ##
==========================================
+ Coverage 91.72% 91.80% +0.08%
==========================================
Files 122 122
Lines 24679 24783 +104
==========================================
+ Hits 22637 22753 +116
+ Misses 2042 2030 -12
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| w.validate()?; | ||
|
|
||
| let workload = Workload::builder(w.name) | ||
| let sizes = w.file_sizes; | ||
| let mut workload = Workload::builder(&w.name) | ||
| .concurrency(w.concurrency) | ||
| .organizations(w.organizations) | ||
| .mode(w.mode) | ||
| .size_distribution(w.file_sizes.p50.0, w.file_sizes.p99.0) | ||
| .min_size(w.file_sizes.min.map_or(0, |b| b.0)) | ||
| .max_size(w.file_sizes.max.map(|b| b.0)) | ||
| .action_weights(w.actions.writes, w.actions.reads, w.actions.deletes) | ||
| .build(); | ||
|
|
||
| stresstest = stresstest.workload(workload); | ||
| .min_size(sizes.min.map_or(0, |b| b.0)) | ||
| .max_size(sizes.max.map(|b| b.0)) | ||
| .action_weights(w.actions.writes, w.actions.reads, w.actions.deletes); | ||
|
|
||
| if let (Some(p50), Some(p99)) = (sizes.p50, sizes.p99) { | ||
| workload = workload.size_distribution(p50.0, p99.0); | ||
| } | ||
| if let Some(buckets) = sizes.buckets { | ||
| let buckets = SizeBuckets::new(buckets) | ||
| .with_context(|| format!("workload '{}': invalid file size buckets", w.name))?; | ||
| workload = workload.size_buckets(buckets); | ||
| } | ||
|
|
||
| stresstest = stresstest.workload(workload.build()); | ||
| } |
There was a problem hiding this comment.
Invalid p50/p99 pairs pass validate then panic in build()
validate() only checks p50 <= p99 when min is also set, and allows p50 == p99, but Workload::build() always does LogNormal::new(...).unwrap() which requires p99 > p50. A percentile-only config with p99 < p50, or any config with p50 == p99 (e.g. fixed-size objects), passes validation and panics at startup. Fix the ordering check in config.rs to run whenever both percentiles are present and require p99 > p50.
Evidence
config.rsvalidate only enters themin < p50 <= p99check insideif let (Some(min), Some(p50), Some(p99)), so withminomitted a config likep50: 100 KiB, p99: 50 KiBis accepted.- That same check uses
p99 < p50, sop50 == p99is accepted even whenminis set, matching the error textp50 <= p99. main.rsthen callssize_distribution(p50.0, p99.0)andworkload.build().WorkloadBuilder::buildcomputessigma = (p99.ln() - p50.ln()) / 2.3263andLogNormal::new(mu, sigma).unwrap();sigma <= 0.0returnsErrand unwrap panics.
Identified by Warden · code-review · 8GY-GL6
A workload built with size buckets still fitted the lognormal distribution from the percentile settings, so settings that buckets replace could make build() panic. The workload now holds one distribution or the other. Percentiles were only checked when min was set, so a p99 below p50 gave a wrong distribution and a p50 of zero panicked. They are now always checked. The Datadog script in the README now reports a scope without data and objects above the largest bucket. The README section is shorter, and its field tables cover both forms of file_sizes.
The check of p50 and p99 without min is not related to size buckets, so this keeps the validation that main has.
The stresstest fits a lognormal distribution to a p50 and a p99, so it guesses all sizes above p99 and sends up to 3.3x the bytes per request of the production usecase it imitates. A workload can now take its file sizes from a histogram of size buckets pulled from the
objectstore.put.sizemetric, which replays the measured distribution.Each bucket is twice the size of the previous one. Buckets that are 4x wide were not accurate enough: the average was up to 1.38x off. The README explains the syntax and how to pull the counts from Datadog, and
config/production.example.yamlhas one workload per production usecase. The counts in that file are rounded, so they are close to production but are not the real data. The rounding moves the average by less than 1%.Accuracy
Each cell is the generated value divided by the production value, for one week of US production.
1.00xis an exact match.Size buckets. Four million sizes per usecase, drawn from the new sampler with the buckets that Datadog returned.
Lognormal (current). Fitted to the real p50 and p99 of each usecase, and computed from the fitted distribution. The p50 and p99 match by construction.
With buckets, the high percentiles of the small usecases can be up to 2x off, because their largest objects are all in the lower part of the last bucket and the sampler spreads them across the full bucket. This has almost no effect on the average.